//
//  JD_AFNetworking.h
//  Jared_AFN_Cache
//
//  Created by Jared on 2017/1/18.
//  Copyright © 2017年 Jared. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "JD_CacheTool.h"
#import "AFNetworking.h"


typedef NS_ENUM(NSInteger, NetworkRequestType) {
    NetworkGetType,
    NetworkPostType,
    NetworkDeleteType,
    NetworkPutType
};

typedef void(^JDBlock)(id responseObject, NSError *error);
typedef void(^JDDownBlock)(id responseObject, id filePath, NSError *error);
//用于上传回调
/** 请求成功的Block */
typedef void(^requestSuccessBlock)(id dic);
/** 请求失败的Block */
typedef void(^requestFailureBlock)(NSError *error);

@interface JD_Cache : NSObject
@property (nonatomic, copy) NSString *fileName; //缓存文件名
@property (nonatomic, assign)BOOL result; //是否重新请求数据
@end

@interface JD_AFNetworking : NSObject

/**
 *  发送网络请求
 *  @param params  参数
 *  @param requestType        请求类型
 *  @param resultBlock 返回结果：responseObject,error
 */
- (void)requestWithURL:(NSString *)path withParams:(NSDictionary *)params withCacheType:(JDCacheType)cacheType withRequestType:(NetworkRequestType)requestType withResult:(JDBlock)resultBlock;


@end











